@extends('layouts.template')

@section('title', '个人中心')

@section('header')
@endsection

@section('content')
    <script src="{{asset('dist/wallet/assureFund.js?v=20170429')}}"></script>
    <script>
        var assure_fund_minimum = Number('{{$assure_fund_minimum}}');
        var default_pay_method = '{{$default_pay_method}}';
    </script>
    <article id="article" v-cloak>

        <form v-show="step == 1">
            <div style="position:absolute;right:25px;top:10px;"><a style="color:#0068b6;"href="{{url('wallet/assurefundhistory')}}">保证金记录</a></div>
            <div class="cash_d">
                <h2>诚信保证金{{$wallet->assure_fund_text}}元</h2>
                @if (empty($wallet->assure_fund))
                    <p>(您还未缴纳)</p>
                @endif
            </div>
            <div class="cash_d2">
                <h2>关于诚信保证金说明：</h2>
                <p>①诚信保证金用于师傅未履行服务承诺协议时对下单用户的赔付资金。</p>
                <p>②诚信保证金最低缴纳金额为200元。</p>
                <p>③缴纳诚信保证金后可以随时自由申请退还（服务中/投诉中/退款中/仲裁中的订单除外），后台审核通过后即可退还到账。</p>
                <p>④未缴纳诚信保证金的师傅，提现时需要支付提现金额2%的提现费，已缴纳的师傅则不用支付。</p>
                <p>⑤成功缴纳诚信保证金的师傅，平台将在网站的"发现师傅"进行宣传推荐和下单用户挑选雇佣师傅时进行优先推荐。</p>
            </div>
            <div class="cash_d3">
                <p>了解并同意<a href="https://qy.weixin.qq.com/cgi-bin/wap_getnewsmsg?action=get&__biz=MzA5MjcwNzQ0OQ==&mixuin=MjU1NTUzNjg3ODI1MDQxMzY2Nw==&mid=10001767&idx=1&sn=d2ac6d26d60f90946a452700e71d50de">《乐帮到家平台服务保障协议》</a></p>

            </div>

            @if (!empty($wallet->assure_fund))
                <a class="but04" @click="step = 2">我要增加保证金</a>
            @else
                <a class="but04" @click="step = 2">我要缴纳</a>
            @endif

            @if (!empty($wallet->assure_fund))
                @if ($wallet->assure_fund_timeup)
                    <a class="but04" @click="doReturn = true">我要退保证金</a>
                @else
                    <a class="but04" style="background:gray">我要退保证金</a>
                @endif
            @endif

        </form>

        <form v-show="step == 2" id="confirmAmountForm">
            <div class="cash_d4 overflow_h"><i>缴纳金额（元）</i>
                <input v-model="amount" name="amount" type="text" class="inp_03" placeholder="请输入缴纳金额">
            </div>
            <div class="cash_d5">诚信保证金缴纳最低金额为{{$assure_fund_minimum}}元。</div>

            <a class="but04" @click="confirmAmount">下一步</a>
        </form>

        <form v-show="step == 3" id="form" method="post" action="{{url('pay/form')}}/">
            {{csrf_field()}}
            <input v-model="amount" name="amount" type="hidden">
            <input v-model="pay_method" name="pay_method" type="hidden"/>
            <input name="trade_type" type="hidden" value="{{$trade_type}}">
            <input name="redirectUrl" type="hidden" value="{{url('wallet/assurefund')}}">
            <div class="cash_d4 overflow_h"><i>缴纳金额（元）</i>
                <span>@{{amount}}元</span>
            </div>
            <div class="cash_d6">
                <h2>选择支付方式</h2>
                <ul>
                    {{--<li @click="pay_method = 'alipay'">--}}
                            {{--<span v-show="pay_method == 'alipay'"><img src="{{asset('images/ico12.png')}}"></span>--}}
                            {{--<i><img src="{{asset('images/ico10.png')}}" ></i>支付宝支付</li>--}}
                    <li @click="pay_method = 'wxpay'">
                            <span v-show="pay_method == 'wxpay'"><img src="{{asset('images/ico12.png')}}"></span>
                            <i><img src="{{asset('images/ico11.png')}}"></i>微信支付</li>
                    <li @click="pay_method = 'balance'" v-show="false">
                            <span v-show="pay_method == 'balance'"><img src="{{asset('images/ico12.png')}}"></span>
                            <i><img src="{{asset('images/tab_3.png')}}"></i>余额支付</li>
                </ul>
            </div>

            <a v-if="!submiting" class="but04" @click="submit">确定缴费</a>
            <a v-else class="but04">提交中...</a>
        </form>

        <div id="payment"></div>

        <div v-if="doReturn" class="od_box">
            <form action="{{url('wallet/returnassurefund')}}" method="post">
                {{csrf_field()}}
                <div class="od_body ">
                    <h1>确认申请退还保证金吗？</h1>
                    <p>1、退还保证金后将会降低您被下单用户雇佣的机率。</p>
                    <p>2、退还保证金后不再享受优先推荐雇佣。</p>
                    <p>3、审核通过后，诚信保证金将会原路退回。</p>
                    <p>4、诚信保证金将在7个工作日内退还到账。</p>
                    <div class="overflow_h">
                        <button class="but03" type="submit">确认</button>
                        <a class="but03" @click="doReturn = false">再考虑一下</a></div>
                </div>
            </form>
        </div>

    </article>
@endsection